/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.M650;
import queenb.web.util.PackageContants;

/**
 * z
 *
 * @author VANANH
 */
public class M650Store extends M650 {

    public int updateM650(
            int pnPM650,
            int pnFH000,
            int pnFH200,
            int pnFB050,
            int pnFH150,
            String pvFC150,
            int pnFC300,
            String pvMV651,
            String pvMV652,
            String pvMV653,
            int pnMN654,
            String pvMV655,
            String pvMV656,
            int pnMN657,
            int pnMN658,
            String pvMV659,
            String pvMV660,
            int pnFF000,
            String pvLogin) throws SQLException {

        DataStatement dataStatement = new DataStatement(PackageContants.UPDATE_M650, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPM650),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFB050),
                    new Param(OracleTypes.INTEGER, pnFH150),
                    new Param(OracleTypes.CHAR, pvFC150),
                    new Param(OracleTypes.INTEGER, pnFC300),
                    new Param(OracleTypes.CHAR, pvMV651),
                    new Param(OracleTypes.CHAR, pvMV652),
                    new Param(OracleTypes.CHAR, pvMV653),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pvMV655),
                    new Param(OracleTypes.CHAR, pvMV656),
                    new Param(OracleTypes.INTEGER, pnMN657),
                    new Param(OracleTypes.INTEGER, pnMN658),
                    new Param(OracleTypes.CHAR, pvMV659),
                    new Param(OracleTypes.CHAR, pvMV660),
                    new Param(OracleTypes.INTEGER, pnFF000),
                    new Param(OracleTypes.CHAR, pvLogin),});

        return super.update(dataStatement, M650.class);

    }

    public List<M650> findM650(
            int pnFH000, int pnFh200, int pnB050, String pvFC150, int pnFC300,
            int pnFF000, int pnMN654, String pnMV655, String pvMV656, int pnMN657,
            int pnMN658, String pnMV659, String pvMV660,int offset, int limit, int sort , int direction, String pvLogin) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_M650, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFh200),
                    new Param(OracleTypes.CHAR, pnB050),
                    new Param(OracleTypes.CHAR, pvFC150),
                    new Param(OracleTypes.CHAR, pnFC300),
                    new Param(OracleTypes.CHAR, pnFF000),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pnMV655),
                    new Param(OracleTypes.CHAR, pvMV656),
                    new Param(OracleTypes.INTEGER, pnMN657),
                    new Param(OracleTypes.INTEGER, pnMN658),
                    new Param(OracleTypes.CHAR, pnMV659),
                    new Param(OracleTypes.CHAR, pvMV660),
                    new Param(OracleTypes.INTEGER, offset),
                    new Param(OracleTypes.INTEGER, limit),
                    new Param(OracleTypes.INTEGER, sort),
                    new Param(OracleTypes.INTEGER, direction),
                    new Param(OracleTypes.CHAR, pvLogin),});

        return super.find(dataStatement, M650.class);

    }

    public int deleteM650(
            int pnPM650,
            String pvLOGIN)
            throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.DELETE_M650, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPM650),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.update(dataStatement, null);
    }

    // Tùng tìm kiếm
    public List<M650> getListDocument_NA(int pnFH000, int pnFH200, int pnFF000, int pnMN654, String pvNV101, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_M650_NA, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFF000),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pvNV101),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, M650.class);
        } catch (SQLException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    //
    public List<M650> getListDocument_PA(int pnFH000, int pnFH200, int pnFF000, int pnMN654, String pvNV109 , String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_M650_PA, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFF000),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pvNV109 ),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, M650.class);
        } catch (SQLException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    public List<M650> getListDocument_TU(int pnFH000, int pnFH200, int pnFF000, int pnMN654, String pvVV051, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_M650_TOU, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFF000),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pvVV051),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, M650.class);
        } catch (SQLException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    public List<M650> getListDocument_CT(int pnFH000, int pnFH200, int pnFF000, int pnMN654, String pvVV051, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_M650_TOU, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFF000),
                    new Param(OracleTypes.INTEGER, pnMN654),
                    new Param(OracleTypes.CHAR, pvVV051),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, M650.class);
        } catch (SQLException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M650Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
